#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#define ll long
#define For(i,x,j)  for(ll (i)=(x);(i)<=(j);++(i))
using namespace std;
inline ll rea(){
	ll t=1,c=0;char x=getchar();
	while(x<'0'||x>'9'){
		if(x=='-')	t=-1;
		x=getchar();
	}
	while(x>='0'&&x<='9'){
		c=c*10+x-'0';
		x=getchar();
	}return t*c;
}
ll n,k,ans;
ll o,wh[510];
char s[510];
bool check(){
	ll l=0,w=0,e=0;
	For(i,0,n-1){
		if(s[i]=='(')	l++;
		if(s[i]==')')	{
			l--;
			if(l==0)	e=0;
			else	e++;
		}
		if(s[i]!='*'){	
			w=0;	
		}
		else	{
			if(i-1>=0&&s[i-1]!='*')	e++;
			if(e>=3)	return 0;	
			w++;
		}
		if(l<0||w>k)	return 0;
	}
	if(l!=0||w)	return 0;
	return 1;
}
void dfs(ll t){
	if(t==o+1){
		if(check())	{
			ans++;
		//	For(i,0,n-1)	cout<<s[i];
		//	cout<<endl;
		}
		return ;
	}
	s[wh[t]]='(';dfs(t+1);
	s[wh[t]]=')';dfs(t+1);
	s[wh[t]]='*';dfs(t+1);
	return ;
}
int main(){
	freopen("bracket.in","r",stdin);
	freopen("bracket.out","w",stdout);
	n=rea();k=rea();
	scanf("%s",s);
	For(i,0,n-1){
		if(s[i]=='?')	wh[++o]=i;
	}
	dfs(1);
	cout<<ans<<endl;
	return 0;
}


